package com.ghsc.ghxc.jsb.ui.message.view

import android.content.Context
import android.text.TextUtils
import android.widget.ImageView
import android.widget.TextView
import com.cn.appcore.ext.setSingleClickListener
import com.cn.appcore.ext.showToast
import com.ghsc.ghxc.jsb.R
import com.ghsc.ghxc.jsb.config.PasswordEditText
import com.lxj.xpopup.core.CenterPopupView

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.message.view
 * 类名：PayPwdPopViiew
 * 创建时间：2024/5/10 09:39
 * 创建人 @author： xiaolin
 * 描述 ：Todo... 支付密码
 */
class PayPwdPopViiew  (context: Context, clickListener: SublickListener) : CenterPopupView(context) {

    override fun getImplLayoutId() = R.layout.pw_pay_pwd
    private var clickListener: SublickListener? = null
    interface SublickListener {
        fun onAdopt(pwdStr: String)
    }

    init {
        this.clickListener = clickListener
    }
    private val mContext = context
    var pwd : PasswordEditText?=null
    var tvBtnNext : TextView?=null
    override fun onCreate() {
        super.onCreate()
        pwd= findViewById<PasswordEditText>(R.id.etPwd)
        tvBtnNext = findViewById<TextView>(R.id.tvBtnNext)
        findViewById<TextView>(R.id.tvBtnClose).setOnClickListener {
            dismiss()
        }
        findViewById<ImageView>(R.id.imgBtnClose).setOnClickListener {
            dismiss()
        }
        tvBtnNext!!.setSingleClickListener {
            if (TextUtils.isEmpty(pwd!!.text.toString().trim())){
                showToast("请输入支付密码")
                return@setSingleClickListener
            }
            clickListener!!.onAdopt(pwd!!.text.toString().trim())
            dismiss()
        }
    }



}